}
}
- // Sort the letters.
- //
- // It's impossible to have the precompiled data file properly sorted,
- // because the sort order changes depending on ICU version. If the
- // array is not properly sorted, the binary search will return random
- // results.
- //
- // We also take this opportunity to remove primary collisions.
+ /* Sort the letters.
+ *
+ * It's impossible to have the precompiled data file properly sorted,
+ * because the sort order changes depending on ICU version. If the
+ * array is not properly sorted, the binary search will return random
+ * results.
+ *
+ * We also take this opportunity to remove primary collisions.
+ */
$letterMap = array();
foreach ( $letters as $letter ) {
$key = $this->getPrimarySortKey( $letter );
}
}
ksort( $letterMap, SORT_STRING );
- // Remove duplicate prefixes. Basically if something has a sortkey
- // which is a prefix of some other sortkey, then it is an
- // expansion and probably should not be considered a section
- // header.
- //
- // For example 'þ' is sometimes sorted as if it is the letters
- // 'th'. Other times it is its own primary element. Another
- // example is '₨'. Sometimes its a currency symbol. Sometimes it
- // is an 'R' followed by an 's'.
- //
- // Additionally an expanded element should always sort directly
- // after its first element due to they way sortkeys work.
- //
- // UCA sortkey elements are of variable length but no collation
- // element should be a prefix of some other element, so I think
- // this is safe. See:
- // * https://ssl.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm
- // * http://site.icu-project.org/design/collation/uca-weight-allocation
- //
- // Additionally, there is something called primary compression to
- // worry about. Basically, if you have two primary elements that
- // are more than one byte and both start with the same byte then
- // the first byte is dropped on the second primary. Additionally
- // either \x03 or \xFF may be added to mean that the next primary
- // does not start with the first byte of the first primary.
- //
- // This shouldn't matter much, as the first primary is not
- // changed, and that is what we are comparing against.
- //
- // tl;dr: This makes some assumptions about how icu implements
- // collations. It seems incredibly unlikely these assumptions
- // will change, but nonetheless they are assumptions.
+
+ /* Remove duplicate prefixes. Basically if something has a sortkey
+ * which is a prefix of some other sortkey, then it is an
+ * expansion and probably should not be considered a section
+ * header.
+ *
+ * For example 'þ' is sometimes sorted as if it is the letters
+ * 'th'. Other times it is its own primary element. Another
+ * example is '₨'. Sometimes its a currency symbol. Sometimes it
+ * is an 'R' followed by an 's'.
+ *
+ * Additionally an expanded element should always sort directly
+ * after its first element due to they way sortkeys work.
+ *
+ * UCA sortkey elements are of variable length but no collation
+ * element should be a prefix of some other element, so I think
+ * this is safe. See:
+ * - https://ssl.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm
+ * - http://site.icu-project.org/design/collation/uca-weight-allocation
+ *
+ * Additionally, there is something called primary compression to
+ * worry about. Basically, if you have two primary elements that
+ * are more than one byte and both start with the same byte then
+ * the first byte is dropped on the second primary. Additionally
+ * either \x03 or \xFF may be added to mean that the next primary
+ * does not start with the first byte of the first primary.
+ *
+ * This shouldn't matter much, as the first primary is not
+ * changed, and that is what we are comparing against.
+ *
+ * tl;dr: This makes some assumptions about how icu implements
+ * collations. It seems incredibly unlikely these assumptions
+ * will change, but nonetheless they are assumptions.
+ */
$prev = false;
$duplicatePrefixes = array();
$status = false;
$logMsg = false;
- // According to the documentation, it is possible for stream_select()
- // to fail due to EINTR. I haven't managed to induce this in testing
- // despite sending various signals. If it did happen, the error
- // message would take the form:
- //
- // stream_select(): unable to select [4]: Interrupted system call (max_fd=5)
- //
- // where [4] is the value of the macro EINTR and "Interrupted system
- // call" is string which according to the Linux manual is "possibly"
- // localised according to LC_MESSAGES.
+ /* According to the documentation, it is possible for stream_select()
+ * to fail due to EINTR. I haven't managed to induce this in testing
+ * despite sending various signals. If it did happen, the error
+ * message would take the form:
+ *
+ * stream_select(): unable to select [4]: Interrupted system call (max_fd=5)
+ *
+ * where [4] is the value of the macro EINTR and "Interrupted system
+ * call" is string which according to the Linux manual is "possibly"
+ * localised according to LC_MESSAGES.
+ */
$eintr = defined( 'SOCKET_EINTR' ) ? SOCKET_EINTR : 4;
$eintrMessage = "stream_select(): unable to select [$eintr]";
*/
function wfGetScriptUrl() {
if ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
- #
- # as it was called, minus the query string.
- #
- # Some sites use Apache rewrite rules to handle subdomains,
- # and have PHP set up in a weird way that causes PHP_SELF
- # to contain the rewritten URL instead of the one that the
- # outside world sees.
- #
- # If in this mode, use SCRIPT_URL instead, which mod_rewrite
- # provides containing the "before" URL.
+ /* as it was called, minus the query string.
+ *
+ * Some sites use Apache rewrite rules to handle subdomains,
+ * and have PHP set up in a weird way that causes PHP_SELF
+ * to contain the rewritten URL instead of the one that the
+ * outside world sees.
+ *
+ * If in this mode, use SCRIPT_URL instead, which mod_rewrite
+ * provides containing the "before" URL.
+ */
return $_SERVER['SCRIPT_NAME'];
} else {
return $_SERVER['URL'];
if ( $media == $targetMedia ) {
$media = '';
} elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
- // This regex will not attempt to understand a comma-separated media_query_list
- //
- // Example supported values for $media:
- // 'screen', 'only screen', 'screen and (min-width: 982px)' ),
- // Example NOT supported value for $media:
- // '3d-glasses, screen, print and resolution > 90dpi'
- //
- // If it's a print request, we never want any kind of screen stylesheets
- // If it's a handheld request (currently the only other choice with a switch),
- // we don't want simple 'screen' but we might want screen queries that
- // have a max-width or something, so we'll pass all others on and let the
- // client do the query.
+ /* This regex will not attempt to understand a comma-separated media_query_list
+ *
+ * Example supported values for $media:
+ * 'screen', 'only screen', 'screen and (min-width: 982px)' ),
+ * Example NOT supported value for $media:
+ * '3d-glasses, screen, print and resolution > 90dpi'
+ *
+ * If it's a print request, we never want any kind of screen stylesheets
+ * If it's a handheld request (currently the only other choice with a switch),
+ * we don't want simple 'screen' but we might want screen queries that
+ * have a max-width or something, so we'll pass all others on and let the
+ * client do the query.
+ */
if ( $targetMedia == 'print' || $media == 'screen' ) {
return null;
}
foreach ( $spaces as $name => $ns ) {
if ( $ns != 0 ) {
- // Fix up link destinations for non-interwiki links only.
- //
- // For example if a page has [[Foo:Bar]] and then a Foo namespace
- // is introduced, pagelinks needs to be updated to have
- // page_namespace = NS_FOO.
- //
- // If instead an interwiki prefix was introduced called "Foo",
- // the link should instead be moved to the iwlinks table. If a new
- // language is introduced called "Foo", or if there is a pagelink
- // [[fr:Bar]] when interlanguage magic links are turned on, the
- // link would have to be moved to the langlinks table. Let's put
- // those cases in the too-hard basket for now. The consequences are
- // not especially severe.
- //
- // @fixme Handle interwiki links, and pagelinks to Category:, File:
- // which probably need reparsing.
+ /* Fix up link destinations for non-interwiki links only.
+ *
+ * For example if a page has [[Foo:Bar]] and then a Foo namespace
+ * is introduced, pagelinks needs to be updated to have
+ * page_namespace = NS_FOO.
+ *
+ * If instead an interwiki prefix was introduced called "Foo",
+ * the link should instead be moved to the iwlinks table. If a new
+ * language is introduced called "Foo", or if there is a pagelink
+ * [[fr:Bar]] when interlanguage magic links are turned on, the
+ * link would have to be moved to the langlinks table. Let's put
+ * those cases in the too-hard basket for now. The consequences are
+ * not especially severe.
+ * @fixme Handle interwiki links, and pagelinks to Category:, File:
+ * which probably need reparsing.
+ */
$this->checkLinkTable( 'pagelinks', 'pl', $ns, $name, $options );
$this->checkLinkTable( 'templatelinks', 'tl', $ns, $name, $options );
$this->db->delete( 'page', array( 'page_id' => $id ), __METHOD__ );
- // Call LinksDeletionUpdate to delete outgoing links from the old title,
- // and update category counts.
- //
- // Calling external code with a fake broken Title is a fairly dubious
- // idea. It's necessary because it's quite a lot of code to duplicate,
- // but that also makes it fragile since it would be easy for someone to
- // accidentally introduce an assumption of title validity to the code we
- // are calling.
+ /* Call LinksDeletionUpdate to delete outgoing links from the old title,
+ * and update category counts.
+ *
+ * Calling external code with a fake broken Title is a fairly dubious
+ * idea. It's necessary because it's quite a lot of code to duplicate,
+ * but that also makes it fragile since it would be easy for someone to
+ * accidentally introduce an assumption of title validity to the code we
+ * are calling.
+ */
$update = new LinksDeletionUpdate( $wikiPage );
$update->doUpdate();
$this->db->commit( __METHOD__ );
return;
}
- // Check to see if the target text_ids have been moved already.
- //
- // We originally read from the slave, so this can happen when a single
- // text_id is shared between multiple pages. It's rare, but possible
- // if a delete/move/undelete cycle splits up a null edit.
- //
- // We do a locking read to prevent closer-run race conditions.
+ /* Check to see if the target text_ids have been moved already.
+ *
+ * We originally read from the slave, so this can happen when a single
+ * text_id is shared between multiple pages. It's rare, but possible
+ * if a delete/move/undelete cycle splits up a null edit.
+ *
+ * We do a locking read to prevent closer-run race conditions.
+ */
$dbw = wfGetDB( DB_MASTER );
$dbw->begin( __METHOD__ );
$res = $dbw->select( 'blob_tracking',
'xmlns' => 'http://a9.com/-/spec/opensearch/1.1/',
'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/' ) );
-// The spec says the ShortName must be no longer than 16 characters,
-// but 16 is *realllly* short. In practice, browsers don't appear to care
-// when we give them a longer string, so we're no longer attempting to trim.
-//
-// Note: ShortName and the <link title=""> need to match; they are used as
-// a key for identifying if the search engine has been added already, *and*
-// as the display name presented to the end-user.
-//
-// Behavior seems about the same between Firefox and IE 7/8 here.
-// 'Description' doesn't appear to be used by either.
+/* The spec says the ShortName must be no longer than 16 characters,
+ * but 16 is *realllly* short. In practice, browsers don't appear to care
+ * when we give them a longer string, so we're no longer attempting to trim.
+ *
+ * Note: ShortName and the <link title=""> need to match; they are used as
+ * a key for identifying if the search engine has been added already, *and*
+ * as the display name presented to the end-user.
+ *
+ * Behavior seems about the same between Firefox and IE 7/8 here.
+ * 'Description' doesn't appear to be used by either.
+ */
$fullName = wfMessage( 'opensearch-desc' )->inContentLanguage()->text();
print Xml::element( 'ShortName', null, $fullName );
print Xml::element( 'Description', null, $fullName );